﻿<?php
	class Application_Form_Admin_NewCardForm extends Zend_Form
{
	public function init()
	{
	$cbbloquees=Application_Model_Carte::getBloquees();
	
	$users=array();
	
	foreach ($cbbloquees as $cb)
	{
		$user=new Application_Model_User();
		try
		{
		$user=$user->getById_Carte($cb->getId());	
		$users[]=$user;
		}
		catch(Exception $e)
		{
		}
		
	}
	
	usort($users, "Application_Model_User::triParNom");

	 $select = new Zend_Form_Element_Select('cible');
    foreach($users as $h)
	  {
	    $select->addMultiOption($h->getLogin(),$h->getNom().' '.$h->getPrenom());
	  }
	  
	 $select->setLabel('Utilisateur :')
	   ->addValidator('NotEmpty')
	   ->setAttrib('id','userBox')
	   ->setAttrib('size',10)
	   ->setDecorators(array('Errors','FormErrors','ViewHelper','Label'));
	  
	 $send = new Zend_Form_Element_Submit('newCard');
	 $send->setLabel('Générer une nouvelle carte')
	   ->setAttrib('class','button');
	 
	 $this->addElements(array($select,$send));
	}
}